package com.nba.service.impl;

import java.util.List;

import com.nba.bean.Page;
import com.nba.bean.Tdate;
import com.nba.bean.inherit.TdateInherit;
import com.nba.dao.TdateDao;
import com.nba.dao.impl.TdateDaoImpl;
import com.nba.service.TdateService;

public class TdateServiceImpl implements TdateService {
	
	TdateDao td = new TdateDaoImpl();
	
	@Override
	public List<Tdate> getTdateAll() {
		return td.selectTdate();
	}

	@Override
	public Tdate getTdateById(int tdateId) {
		// TODO Auto-generated method stub
		return td.selectTdateById(tdateId);
	}

	@Override
	public int addTdate(Tdate tdate) {
		// TODO Auto-generated method stub
		return td.insertTdate(tdate);
	}

	@Override
	public int updateTdate(Tdate tdate) {
		// TODO Auto-generated method stub
		return td.updateTdate(tdate);
	}

	@Override
	public int deleteTdate(int tdateId) {
		// TODO Auto-generated method stub
		return td.deleteTdate(tdateId);
	}

	@Override
	public Page<TdateInherit> getTdateAll(String keyword, int pageNum, int pageSize) {
		List<TdateInherit> data = td.selectTdateAll(keyword, pageNum, pageSize); 
		int totalRows = td.selectTdateTotal(keyword);
		return new Page<TdateInherit>(data, pageNum, pageSize, totalRows);
	}

}
